Ext.define('jwawa.erp.common.SearchPanel', {
    extend: "Ext.form.Panel",
    alias: 'widget.searchPanel',
    handlerClass: 'jwawa.erp.common.SearchPanelHandler',
    height: 77,
    bodyPadding: 10,
    hideCollapseTool: true,
    collapseFirst: false,
    collapsed: false,
    collapsible: true,
    preventHeader: true,
    titleCollapse:true,
    title: '查询条件',
    region: 'north',
    split: true,
    border: false,
    layout: {type: 'column'},
    floatable: false,
    componentCls: 'boxLineBottom',
    pageCode: null,
    currentSearchData: null,
    handler: null,
    rowFieldNum: 4,
    dockedItems: [
        {
            xtype: 'toolbar',
            region: 'center',
            dock: 'top',
            items: [
                {
                    itemId: 'searchButton',
                    xtype: 'button',
                    text: '查询',
                    icon: '/img/magnifier.png'
                },
                {
                    itemId: 'resetButton',
                    xtype: 'button',
                    text: '重置',
                    icon: '/img/zoom_refresh.png'
                },
                {
                    xtype: 'tbseparator'
                },
                {
                    itemId: 'searchGroupCombobox',
                    xtype: 'combobox',
                    submitValue: false,
                    queryMode: 'local',
                    displayField: 'group_name',
                    valueField: 'id',
                    editable : false,
                    allowBlank: true
                },
                {
                    itemId: 'openAdvanceSearchWinButton',
                    xtype: 'button',
                    text: '自定义',
                    icon: '/img/google_custom_search.png'
                },
                {
                    xtype: 'tbspacer',
                    flex: 1,
                    autoScroll: false
                },
                {
                    xtype: 'label',
                    text: '查询条件',
                    cls: 'toolbar-title'
                }
            ]
        }
    ],

    constructor: function(params){
        var me = this,
            handler;

        if(Ext.isString(me.handlerClass)){
            handler = Ext.create(me.handlerClass, {
                view: me
            });
            me.handler = handler;
        }

        me.callParent(arguments);
    },

    initComponent: function() {
        var me = this;

        me.callParent(arguments);
        me.addEvents('search');
        me.handler.bindHandler();
//        me.addListener('afterrender', function(){
//            handler.bindHandler();
//        });
    }
});